home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 2
/
Gold Medal Software Volume 2 (Gold Medal) (1994).iso
/
windows
/
win31
/
macsyma.arj
/
MACSDEMO.EXE
/
BALLIST2.OUT
< prev
next >
Wrap
Text File
|
1993-09-08
|
5KB
|
82 lines
(c1) /* SOLVE FOR TRAJECTORY OF A CANNON BALL
WITH GRAVITY, WIND, AND AIR RESISTANCE
X = Horizontal direction of initial trajectory
Z = Vertical direction
M = Mass of projectile
B = Air resistance coefficient
G = Gravitational constant
V0 = Muzzle velocity
THETA= Angle of gun elevation
W = Wind speed (horizontal only)
PHI= Angle between wind and X-direction
*/
depends( [x,y,z], t )$
(c2) assume( b>0 )$
(c3) eqx : m*diff(x,t,2) = - b*diff(x,t) + w*cos(phi);
|$label(0,15,Times New Roman,$(d3$))m$hinge()$in( )$q($sup(d,2)x,d$sup(t,2))$hinge()$in( = )cos$paren($greektext(f))$in( )w$hinge()$in( - )b$in( )$q(dx,dt)
(c4) eqy : m*diff(y,t,2) = - b*diff(y,t) + w*sin(phi);
|$label(0,15,Times New Roman,$(d4$))m$hinge()$in( )$q($sup(d,2)y,d$sup(t,2))$hinge()$in( = )sin$paren($greektext(f))$in( )w$hinge()$in( - )b$in( )$q(dy,dt)
(c5) eqz : m*diff(z,t,2) = - b*diff(z,t) - m*g;
|$label(0,15,Times New Roman,$(d5$))m$hinge()$in( )$q($sup(d,2)z,d$sup(t,2))$hinge()$in( = )$in( - )b$in( )$q(dz,dt)$hinge()$in( - )g$in( )m
(c6) gen_sol : ode2( eqx, x, t );
C:\MACGOLD5\ode\ode2.fas being loaded.
|$label(0,15,Times New Roman,$(d6$))x$hinge()$in( = )$q($paren(b$in( )cos$paren($greektext(f))$in( )t$in( - )m$in( )cos$paren($greektext(f)),$(,$))$in( )w,$sup(b,2))$hinge()$in( + )%k2$in( )$sup($e(),$in( - )$q(b$in( )t,m))$hinge()$in( + )%k1
(c7) xsol : ic2( gen_sol, t=0, x=0, diff(x,t)=v0*cos(theta) );
|$label(0,15,Times New Roman,$(d7$))x$hinge()$in( = )$q($sup($e(),$in( - )$q(b$in( )t,m))$in( )$paren(m$in( )cos$paren($greektext(f))$in( )w$in( - )b$in( )m$in( )cos$paren($greektext(q))$in( )v0,$(,$)),$sup(b,2))$hinge()$in( + )$q($paren(b$in( )cos$paren($greektext(f))$in( )t$in( - )m$in( )cos$paren($greektext(f)),$(,$))$in( )w,$sup(b,2))$hinge()$in( + )$q(m$in( )cos$paren($greektext(q))$in( )v0,b)
(c8) gen_sol : ode2( eqy, y, t );
|$label(0,15,Times New Roman,$(d8$))y$hinge()$in( = )$q($paren(b$in( )sin$paren($greektext(f))$in( )t$in( - )m$in( )sin$paren($greektext(f)),$(,$))$in( )w,$sup(b,2))$hinge()$in( + )%k2$in( )$sup($e(),$in( - )$q(b$in( )t,m))$hinge()$in( + )%k1
(c9) ysol : ic2( gen_sol, t=0, y=0, diff(y,t)=0 );
|$label(0,15,Times New Roman,$(d9$))y$hinge()$in( = )$q(m$in( )sin$paren($greektext(f))$in( )$sup($e(),$in( - )$q(b$in( )t,m))$in( )w,$sup(b,2))$hinge()$in( + )$q($paren(b$in( )sin$paren($greektext(f))$in( )t$in( - )m$in( )sin$paren($greektext(f)),$(,$))$in( )w,$sup(b,2))
(c10) gen_sol : ode2( eqz, z, t );
|$label(0,15,Times New Roman,$(d10$))z$hinge()$in( = )%k2$in( )$sup($e(),$in( - )$q(b$in( )t,m))$hinge()$in( - )$q(b$in( )g$in( )m$in( )t$in( - )g$in( )$sup(m,2),$sup(b,2))$hinge()$in( + )%k1
(c11) zsol : ic2( gen_sol, t=0, z=0, diff(z,t)=v0*sin(theta) );
|$label(0,15,Times New Roman,$(d11$))z$hinge()$in( = )$in( - )$q($sup($e(),$in( - )$q(b$in( )t,m))$in( )$paren(b$in( )m$in( )sin$paren($greektext(q))$in( )v0$in( + )g$in( )$sup(m,2),$(,$)),$sup(b,2))$hinge()$in( + )$q(m$in( )sin$paren($greektext(q))$in( )v0,b)$hinge()$in( - )$q(b$in( )g$in( )m$in( )t$in( - )g$in( )$sup(m,2),$sup(b,2))
(c12) params : [ g=9.8, b=1., m=100., v0=300., theta=sfloat(%pi/4),
w=30., phi=sfloat(%pi/2 )]$
(c13) xnum : expand(rhs(xsol)), params;
|$label(0,15,Times New Roman,$(d13$))$in( - )21213.2$in( )$sup($e(),$in( - )0.01$in( )t)$hinge()$in( + )9.41751e-6$in( )t$hinge()$in( + )21213.2
(c14) ynum : expand(rhs(ysol)), params;
|$label(0,15,Times New Roman,$(d14$))3000.0$in( )$sup($e(),$in( - )0.01$in( )t)$hinge()$in( + )30.0$in( )t$hinge()$in( - )3000.0
(c15) znum : expand(rhs(zsol)), params;
|$label(0,15,Times New Roman,$(d15$))$in( - )119213.2$in( )$sup($e(),$in( - )0.01$in( )t)$hinge()$in( - )980.0$in( )t$hinge()$in( + )119213.2
(c16) landing_time : root_by_bisection(znum,t,0.,120.);
C:\MACGOLD5\share\bisect.fas being loaded.
|$label(0,15,Times New Roman,$(d16$))40.5581
(c17) xlanding : xnum, t=landing_time;
|$label(0,15,Times New Roman,$(d17$))7072.71
(c18) ylanding : ynum, t=landing_time;
|$label(0,15,Times New Roman,$(d18$))216.512
(c19) landing_distance : sqrt(xlanding^2 + ylanding^2);
|$label(0,15,Times New Roman,$(d19$))7076.02
(c20) paramplot(xnum,znum,t,0,landing_time,
"X","Height","Plot of Height Against X Coordinate")$
(c21) paramplot(xnum,ynum,t,0,landing_time,
"X","Y","Plot of Horizontal Position in 2D")$
(c22) /* Clean Up */
(remvalue(eqx,eqy,eqz,gen_sol,landing_distance,landing_time,params),
remvalue(xlanding,xnum,xsol,ylanding,ynum,ysol,znum,zsol),
forget(b>0),remove([x,y,z],dependency))$